/******************************************************************************
 * * qq_data_interface.h
 *
 * *(C) Copyright 2019 Asr International Ltd.
 * * All Rights Reserved
 * ******************************************************************************/

#ifndef _QQ_DATA_INTERFACE_H_
#define _QQ_DATA_INTERFACE_H_

#ifdef __cplusplus
extern "C" {
#endif /* __cpluscplus */

#ifdef LV_CONF_INCLUDE_SIMPLE
#include "lvgl.h"
#include "lv_watch_conf.h"
#else
#include "../../../lvgl/lvgl.h"
#include "../../../lv_watch_conf.h"
#endif

#define QQ_ID_LEN  12
#define QQ_HEAD_PATH_LEN  20

typedef struct {
    char      qqid[QQ_ID_LEN];        //qqid
    char      openid[64];             //openid
    char      access_token[64];       //access_token
    char      nickname[128];
    char      head_path[QQ_HEAD_PATH_LEN];
    uint32_t  login_time;             //seconds
} watch_qq_login_info_t;

typedef struct {
    char      qqid[QQ_ID_LEN];        //friend's qqid
    char      openid[64];
    char      headpath[QQ_HEAD_PATH_LEN];          //file path of head img
    uint16_t  msg_seq_id;
} watch_qq_friend_info_t;

extern void watch_qq_save_login_info(watch_qq_login_info_t * info);
extern watch_qq_login_info_t * watch_qq_get_last_login_info(void);
extern void watch_qq_save_my_head_path(char * qqid, char * path);

extern void watch_qq_add_friend(watch_qq_friend_info_t * info);
extern void watch_qq_del_friend(char * qqid_friend);
extern char * watch_qq_get_friend_head_path(char * openid_friend);
extern void watch_qq_update_friend_seq_id(char * qqid_friend, uint16_t seq_id);
extern uint16_t watch_qq_get_friend_seq_id(char * qqid_friend);

#ifdef __cplusplus
}
#endif /* __cpluscplus */

#endif /* end of _QQ_DATA_INTERFACE_H_ */

